% PURPOSE: Outputs results for Table 7 and 8 of paper with characteristic based portfolios as the investment universe.
% INPUTS:
%  data2017.mat : data for individual security returns and size from CRSP
%  'galton_RFS_table1.mat': Datastructure with Galton (all stocks)
%  shrinkage estimates. This file is generated in Tables_1_Galton_Coeffs.m
%  'galton_RFS_table1_ex_microcaps.mat': Datastructure with Galton (ex
%  microcaps) shrinkage estimates. This file is generated in Tables_1_Galton_Coeffs_ex_microcaps.m
%
%PARAMETERS:
%pre_window=The historical sample estimation window H
%post_window=The period of the subsequent realized window E
%learning_window=The window for Galton to pre-learn and others to skip
%data.SampleStart = The start date for sample and for Galton learning
%data.SampleEnd   = The end date for the sample. Galton learning stops "post_window" E months earlier
%stats = The statistics from the horserace requested for output and
%display. These are calculated in TradingStrategy.m
%
%OUTPUT:
%  table_out: Table 8 results summarizing results with various
%  characteristic based portfolios


clear

[tables1, names] = Table_Char_Ports(1,196307,201711);
table_out = NaN(size(tables1,1),8);
table_out(:,[1,5]) = tables1;
[table_out(:,[2,6])] = Table_Char_Ports(2,196307,201711);
[table_out(:,[3,7])] = Table_Char_Ports(3,196307,201711);
[table_out(:,[4,8])] = Table_Char_Ports(4,196307,201711);


latexOutput(table_out,zeros(1,size(names,1)),names,'Table 8: OOS performance and risk summary');
